Optimal. Leaf size=198 \[ \frac {(A b-a B) E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{b \left (a^2-b^2\right ) d}+\frac {\left (a A b+a^2 B-2 b^2 B\right ) F\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{b^2 \left (a^2-b^2\right ) d}-\frac {\left (a^2 A b+A b^3+a^3 B-3 a b^2 B\right ) \Pi \left (\frac {2 b}{a+b};\left .\frac {1}{2} (c+d x)\right |2\right )}{(a-b) b^2 (a+b)^2 d}-\frac {(A b-a B) \sqrt {\cos (c+d x)} \sin (c+d x)}{\left (a^2-b^2\right ) d (a+b \cos (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.35, antiderivative size = 198, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 33, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {3078, 3138,
2719, 3081, 2720, 2884} \begin {gather*} \frac {\left (a^2 B+a A b-2 b^2 B\right ) F\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{b^2 d \left (a^2-b^2\right )}+\frac {(A b-a B) E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{b d \left (a^2-b^2\right )}-\frac {(A b-a B) \sin (c+d x) \sqrt {\cos (c+d x)}}{d \left (a^2-b^2\right ) (a+b \cos (c+d x))}-\frac {\left (a^3 B+a^2 A b-3 a b^2 B+A b^3\right ) \Pi \left (\frac {2 b}{a+b};\left .\frac {1}{2} (c+d x)\right |2\right )}{b^2 d (a-b) (a+b)^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2719
Rule 2720
Rule 2884
Rule 3078
Rule 3081
Rule 3138
Rubi steps
\begin {align*} \int \frac {\sqrt {\cos (c+d x)} (A+B \cos (c+d x))}{(a+b \cos (c+d x))^2} \, dx &=-\frac {(A b-a B) \sqrt {\cos (c+d x)} \sin (c+d x)}{\left (a^2-b^2\right ) d (a+b \cos (c+d x))}+\frac {\int \frac {\frac {1}{2} (A b-a B)-(a A-b B) \cos (c+d x)-\frac {1}{2} (A b-a B) \cos ^2(c+d x)}{\sqrt {\cos (c+d x)} (a+b \cos (c+d x))} \, dx}{-a^2+b^2}\\ &=-\frac {(A b-a B) \sqrt {\cos (c+d x)} \sin (c+d x)}{\left (a^2-b^2\right ) d (a+b \cos (c+d x))}+\frac {\int \frac {-\frac {1}{2} b (A b-a B)+\frac {1}{2} \left (a A b+a^2 B-2 b^2 B\right ) \cos (c+d x)}{\sqrt {\cos (c+d x)} (a+b \cos (c+d x))} \, dx}{b \left (a^2-b^2\right )}+\frac {(A b-a B) \int \sqrt {\cos (c+d x)} \, dx}{2 b \left (a^2-b^2\right )}\\ &=\frac {(A b-a B) E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{b \left (a^2-b^2\right ) d}-\frac {(A b-a B) \sqrt {\cos (c+d x)} \sin (c+d x)}{\left (a^2-b^2\right ) d (a+b \cos (c+d x))}+\frac {\left (a A b+a^2 B-2 b^2 B\right ) \int \frac {1}{\sqrt {\cos (c+d x)}} \, dx}{2 b^2 \left (a^2-b^2\right )}-\frac {\left (a^2 A b+A b^3+a^3 B-3 a b^2 B\right ) \int \frac {1}{\sqrt {\cos (c+d x)} (a+b \cos (c+d x))} \, dx}{2 b^2 \left (a^2-b^2\right )}\\ &=\frac {(A b-a B) E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{b \left (a^2-b^2\right ) d}+\frac {\left (a A b+a^2 B-2 b^2 B\right ) F\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{b^2 \left (a^2-b^2\right ) d}-\frac {\left (a^2 A b+A b^3+a^3 B-3 a b^2 B\right ) \Pi \left (\frac {2 b}{a+b};\left .\frac {1}{2} (c+d x)\right |2\right )}{(a-b) b^2 (a+b)^2 d}-\frac {(A b-a B) \sqrt {\cos (c+d x)} \sin (c+d x)}{\left (a^2-b^2\right ) d (a+b \cos (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 12.40, size = 260, normalized size = 1.31 \begin {gather*} \frac {\frac {4 (-A b+a B) \sqrt {\cos (c+d x)} \sin (c+d x)}{\left (a^2-b^2\right ) (a+b \cos (c+d x))}-\frac {\frac {2 (-A b+a B) \Pi \left (\frac {2 b}{a+b};\left .\frac {1}{2} (c+d x)\right |2\right )}{a+b}+\frac {(4 a A-4 b B) \left (2 F\left (\left .\frac {1}{2} (c+d x)\right |2\right )-\frac {2 a \Pi \left (\frac {2 b}{a+b};\left .\frac {1}{2} (c+d x)\right |2\right )}{a+b}\right )}{b}+\frac {2 (A b-a B) \left (-2 a b E\left (\left .\text {ArcSin}\left (\sqrt {\cos (c+d x)}\right )\right |-1\right )+2 a (a+b) F\left (\left .\text {ArcSin}\left (\sqrt {\cos (c+d x)}\right )\right |-1\right )+\left (-2 a^2+b^2\right ) \Pi \left (-\frac {b}{a};\left .\text {ArcSin}\left (\sqrt {\cos (c+d x)}\right )\right |-1\right )\right ) \sin (c+d x)}{a b^2 \sqrt {\sin ^2(c+d x)}}}{(-a+b) (a+b)}}{4 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(807\) vs.
\(2(274)=548\).
time = 0.63, size = 808, normalized size = 4.08
method | result | size |
default | \(-\frac {\sqrt {-\left (-2 \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+1\right ) \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}\, \left (\frac {2 B \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-2 \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+1}\, \EllipticF \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )}{b^{2} \sqrt {-2 \left (\sin ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}}-\frac {4 \left (A b -2 a B \right ) \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-2 \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+1}\, \EllipticPi \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), -\frac {2 b}{a -b}, \sqrt {2}\right )}{b \left (-2 a b +2 b^{2}\right ) \sqrt {-2 \left (\sin ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}}-\frac {2 a \left (A b -a B \right ) \left (-\frac {b^{2} \cos \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {-2 \left (\sin ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}}{a \left (a^{2}-b^{2}\right ) \left (2 \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b +a -b \right )}-\frac {\sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-2 \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+1}\, \EllipticF \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )}{2 \left (a +b \right ) a \sqrt {-2 \left (\sin ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}}-\frac {b \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-2 \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+1}\, \EllipticF \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )}{2 a \left (a^{2}-b^{2}\right ) \sqrt {-2 \left (\sin ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}}+\frac {b \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-2 \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+1}\, \EllipticE \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right )}{2 a \left (a^{2}-b^{2}\right ) \sqrt {-2 \left (\sin ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}}-\frac {3 a b \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-2 \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+1}\, \EllipticPi \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), -\frac {2 b}{a -b}, \sqrt {2}\right )}{\left (a^{2}-b^{2}\right ) \left (-2 a b +2 b^{2}\right ) \sqrt {-2 \left (\sin ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}}+\frac {b^{3} \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {-2 \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+1}\, \EllipticPi \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), -\frac {2 b}{a -b}, \sqrt {2}\right )}{a \left (a^{2}-b^{2}\right ) \left (-2 a b +2 b^{2}\right ) \sqrt {-2 \left (\sin ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}}\right )}{b^{2}}\right )}{\sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {2 \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-1}\, d}\) | \(808\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {\sqrt {\cos \left (c+d\,x\right )}\,\left (A+B\,\cos \left (c+d\,x\right )\right )}{{\left (a+b\,\cos \left (c+d\,x\right )\right )}^2} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________